//
//  TFMsg.swift
//  TalkfunSDKDemo
//
//  Created by 莫瑞权 on 2022/5/7.
//  Copyright © 2022 Talkfun. All rights reserved.
//

import UIKit

class TFMsg: UITextField {

    override func textRect(forBounds bounds: CGRect) -> CGRect {

        let superRect = super.textRect(forBounds: bounds)
        
        return CGRect(x: superRect.origin.x + 10, y: superRect.origin.y, width: superRect.size.width - 10*2, height: superRect.size.height)
    }
//    - (CGRect)textRectForBounds:(CGRect)bounds {
//        CGRect superRect = [super textRectForBounds:bounds];
//        return CGRectMake(superRect.origin.x + 10, superRect.origin.y, superRect.size.width - 10*2, superRect.size.height);
//    }
    override func editingRect(forBounds bounds: CGRect) -> CGRect {
        return self.textRect(forBounds: bounds)
    }
   
//    - (CGRect)editingRectForBounds:(CGRect)bounds {
//        return [self textRectForBounds:bounds];
//    }

    
    override func leftViewRect(forBounds bounds: CGRect) -> CGRect {
        
        var rect = super.leftViewRect(forBounds: bounds)
        rect.origin.x = rect.origin.x+10
        return rect;
    }
    
//    - (CGRect)leftViewRectForBounds:(CGRect)bounds {
//        CGRect rect = [super leftViewRectForBounds:bounds];
//        rect.origin.x += 10;
//        return rect;
//    }

    override func rightViewRect(forBounds bounds: CGRect) -> CGRect {
        var rect = super.rightViewRect(forBounds: bounds)
        rect.origin.x = rect.origin.x+10
        return rect;
    }
//    - (CGRect)rightViewRectForBounds:(CGRect)bounds {
//        CGRect rect = [super rightViewRectForBounds:bounds];
//        rect.origin.x -= 10;
//        return rect;
//    }
}
